{template '_header'}

<div class="page-heading">
	<span class='pull-right'>
				{ifp 'exhelper.temp.invoice.add'}
					<a class='btn btn-primary btn-sm' href="{php echo webUrl('exhelper/temp/invoice/add')}"><i class='fa fa-plus'></i> 添加模板</a>
				{/if}
    </span>
	<h2>发货单模板管理 <small>数量: <span class='text-danger'>{$total}</span> 条</small></h2> 
</div>

<form action="./index.php" method="get" class="form-horizontal" plugins="form">
	<input type="hidden" name="c" value="site" />
	<input type="hidden" name="a" value="entry" />
	<input type="hidden" name="m" value="ewei_shopv2" />
	<input type="hidden" name="do" value="web" />
	<input type="hidden" name="r" value="exhelper.temp.invoice" />
	<div class="page-toolbar row m-b-sm m-t-sm">
		<div class="col-sm-4"> 
			<div class="input-group-btn">
				<button class="btn btn-default btn-sm" type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
				{ifp 'exhelper.temp.invoice.delete'}
					<button class="btn btn-default btn-sm" type="button" data-toggle='batch-remove' data-confirm="确认要删除选中内容吗?" data-href="{php echo webUrl('exhelper/temp/invoice/delete')}"><i class='fa fa-trash'></i> 删除</button>
				{/if}
			</div>
		</div> 

		<div class="col-sm-8 pull-right">
			<div class="input-group">
				<input type="text" class="input-sm form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="输入快递单模版名称进行搜索"> <span class="input-group-btn">
					<button class="btn btn-sm btn-primary" type="submit"> 搜索</button> </span>
			</div>
		</div>
	</div>
</form>

<form action="" method="post">
	<table class="table table-hover table-responsive">
		<thead>
			<tr>
				<th style="width:25px;">
					<input type='checkbox' />
				</th>
				<th>{if $type==1}快递单{elseif $type==2}发货单{/if}模版名称</th>
				<th style="width:100px;">快递公司</th>
				<th style="width:50px;">默认</th>
				<th style="width:145px;">操作</th>
			</tr>
		</thead>
		<tbody>
			{loop $list $row}
				<tr>
					<td>
						<input type='checkbox' value="{$row['id']}" />
					</td>
					<td>{if !empty($row['expressname'])}{$row['expressname']}{else}未填写{/if}</td>
					<td>
						<span class="label label-success">{$row['expresscom']}</span>
					</td>
					<td>
						<span class='defaults label {if $row['isdefault']==1}label-primary{else}label-default{/if}' 
	                      {ifp 'exhelper.temp.invoice.setdefault'}
	                      data-toggle='ajaxSwitch' 
	                      data-confirm = "确认{if $row['isdefault']==1}取消{else}设为{/if}默认吗？"
	                      data-switch-css='.defaults'
                          data-switch-other = 'true'
	                      data-switch-value='{$row['isdefault']}'
	                      data-switch-value0='0|否|label label-default|{php echo webUrl('exhelper/temp/invoice/setdefault',array('isdefault'=>1, 'id'=>$row['id'], 'type'=>$type))}'  
	                      data-switch-value1='1|是|label label-primary|{php echo webUrl('exhelper/temp/invoice/setdefault',array('isdefault'=>0, 'id'=>$row['id'], 'type'=>$type))}'  
	                      style="cursor: pointer;"
	                      {/if}
	                    >{if $row['isdefault']==1}是{else}否{/if}</span>
					</td>
					<td>
						{ifp 'exhelper.temp.invoice.edit'}
						<a class='btn btn-default btn-sm' href="{php echo webUrl('exhelper/temp/invoice/edit',array('id' => $row['id']));}"><i class='fa fa-edit'></i> 编辑</a> {/if}
						 {ifp 'exhelper.temp.invoice.delete'}
						 <a class='btn btn-default btn-sm'
						data-toggle='ajaxRemove' href="{php echo webUrl('exhelper/temp/invoice/delete',array('id' => $row['id']));}" data-confirm="确定要删除该模板吗？"><i class='fa fa-trash'></i> 删除</a>{/if}
					</td>
				</tr>
			{/loop}
		</tbody>
	</table>
	{$pager}

</form>
{template '_footer'}